]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Always emit ::pressed late on keys with variants
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 1 Apr 2021 17:25:24 +0000 (19:25 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 27 Apr 2021 20:02:53 +0000 (22:02 +0200)
When we press a key with variants, we used to prevent an
early ::pressed, because a long press could show the options
popover, and the press be undone.

In addition, this long press could move to one of the suboptions,
and be released there. For this case we also want this late
emission of the ::pressed signal.

This makes the "tap, drag, release" pattern work on the
regular OSK keys, in addition to the emoji panel.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1789>

js/ui/keyboard.js

index c6d6fab60afcc373218ed368a8119560b9ba61e0..bc72d77f3d36e2a756291493a4410e7cc914034c 100644 (file)
@@ -296,7 +296,6 @@ var Key = GObject.registerClass({
 
         this._capturedEventId = 0;
         this._unmapId = 0;
-        this._longPress = false;
     }
 
     _onDestroy() {
@@ -334,14 +333,13 @@ var Key = GObject.registerClass({
     _press(key) {
         this.emit('activated');
 
-        if (key !== this.key || this._extendedKeys.length === 0)
+        if (this._extendedKeys.length === 0)
             this.emit('pressed', this._getKeyval(key), key);
 
         if (key == this.key) {
             this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
                 KEY_LONG_PRESS_TIME,
                 () => {
-                    this._longPress = true;
                     this._pressTimeoutId = 0;
 
                     this.emit('long-press');
@@ -365,12 +363,11 @@ var Key = GObject.registerClass({
             this._pressTimeoutId = 0;
         }
 
-        if (!this._longPress && key === this.key && this._extendedKeys.length > 0)
+        if (this._extendedKeys.length > 0)
             this.emit('pressed', this._getKeyval(key), key);
 
         this.emit('released', this._getKeyval(key), key);
         this._hideSubkeys();
-        this._longPress = false;
     }
 
     cancel() {